<template>
  <d2-container>
    <div class="muse_filter_box">
      <el-form ref="filtersForm" :model="form">
        <el-row :gutter="20">
          <el-col :span="6">
            <el-form-item>
              <el-input placeholder="会员手机号" v-model="form.cellphone"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-button type="primary" @click="filterSearch('filtersForm')">搜索</el-button>
            <el-button @click="resetFormByFilter('filtersForm')">重置</el-button>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <div class="muse_table_box">
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="user.cellphone" label="会员电话号" />
        <el-table-column prop="originalPoints" label="修改前几积分" />
        <el-table-column prop="currentPoints" label="修改后积分" />
        <el-table-column label="变更状态(分)">
          <template
            slot-scope="scope"
          >{{ (scope.row.type == 0 ? '加':'减') + ' ' + scope.row.amount }}</template>
        </el-table-column>
        <el-table-column prop="account.account" label="处理员工" />
      </el-table>
      <el-pagination
        class="muse_pagination"
        :background="true"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="paging.page"
        :page-sizes="paging.pageSizeAry"
        :page-size="paging.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="paging.total"
      ></el-pagination>
    </div>
  </d2-container>
</template>

<script>
import tableMixin from "../mixins/tableMixin";
import { getManualChangePointList } from "@/api/admin";
import excel from "@/libs/util.excel.js";
export default {
  mixins: [tableMixin],
  data() {
    return {
      form: {
        cellphone: "",
      },
    };
  },
  created() {
    this.getTableData();
  },
  methods: {
    // 获取列表数据
    async getTableData(value, type) {
      let params = {
        page:
          type === "page"
            ? value
              ? value
              : this.paging.page
            : this.paging.page,
        pageSize:
          type === "pageSize"
            ? value
              ? value
              : this.paging.pageSize
            : this.paging.pageSize,
      };
      params = Object.assign({}, params, this.form);
      const {
        code,
        data: { total, currentPage, data, pageSize },
      } = await getManualChangePointList(params);
      this.paging.total = total;
      this.paging.pageSize = pageSize;
      this.paging.page = currentPage;
      this.tableData = data;
    },
  },
};
</script>

<style scoped>
</style>
